﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<VietThuongLMS.ViewModels.AccountViewModel>" %>

<br />
<table class="table table-striped table-advance table-hover">
    <tr><th>Mã tài khoản</th><th>Họ tên</th><th>Điện thoại</th><th>Địa chỉ</th><th></th></tr>
    <% for (int i = 0; i < Model.ListMoRong.Count; i++){%>
        
        <tr>
            <td><%:Model.ListMoRong.ElementAt(i).TK.MaTaiKhoan%></td>
            <td><%:Model.ListMoRong.ElementAt(i).TK.HoTen%></td>
            <td><%:Model.ListMoRong.ElementAt(i).TK.DienThoai%></td>
            <td><%:Model.ListMoRong.ElementAt(i).TK.DiaChi%></td>
            <td>
                <a class="btn btn-info" href="javascript:searchingClassTask('<%:Model.ListMoRong.ElementAt(i).TK.ID.ToString() %>')"><i class="icon-dollar"></i></a>
                <a class="btn btn-success" href="javascript:searchingLoaiLopHoc_GiaoVien('<%:Model.ListMoRong.ElementAt(i).MaGiaoVien.ToString() %>')"><i class="icon-edit"></i></a>
            </td>
        </tr>
    <% }%>
</table>

<p>
    <%if ((string)ViewData["pageLinks"] != "")
        { %>
    <%= ViewData["pageLinks"]%>
    <%}
        else
        { %>
        Emptylist
    <%} %>   
</p>
<br />
<p><a class="btn btn-info" href="#"><i class="icon-dollar"></i></a>&nbsp;&nbsp;Tính lương</p>
<p><a class="btn btn-success" href="#"><i class="icon-edit"></i></a>&nbsp;Xem thông tin bảng lương giáo viên</p>
<script type="text/javascript">
    function searchingClassTask(idgv) {
        var month = document.getElementById("month").value;
        var year = document.getElementById("year").value;     
        $.ajax(
            {
                type: "POST",
                url: "<%=ResolveUrl("~/")%>Admin/Salary/TimPhanCong",
                data: { id: idgv, m:month, y:year },
                success: function (result) {
                    $("#searchingResult").html(result.toString());
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    thrownError;
                    $("#searchingResult").html("Không tìm thấy dữ liệu yêu cầu");
                }
            });
    }

    function searchingLoaiLopHoc_GiaoVien(idgv)
    {
            $.ajax(
            {
                type: "POST",
                url: "<%=ResolveUrl("~/")%>Admin/Salary/DanhSachLuongGiaoVien",
                data: { mgv: idgv },
                success: function (result) {
                    $("#searchingResult").html(result.toString());
                },
                error: function (xhr, ajaxOptions, thrownError) {
                    
                    thrownError;
                    $("#searchingResult").html(xhr.toString());
                }
            });    
    }
</script>